import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("district", { schema: "cabinet" })
export class District {
  @PrimaryGeneratedColumn({ type: "smallint", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "name", comment: "区域名称", length: 20 })
  name: string;

  @Column("varchar", { name: "code", comment: "区域编码", length: 10 })
  code: string;

  @Column("tinyint", {
    name: "level",
    comment: "区域级别",
    unsigned: true,
    default: () => "'1'",
  })
  level: number;

  @Column("smallint", {
    name: "parent_id",
    unsigned: true,
    default: () => "'0'",
  })
  parentId: number;
}
